package com.zsrt.oa.teacher.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zsrt.oa.teacher.service.TeacherService;

@Controller
@RequestMapping("/teacher")
public class TeacherController {
	
	@Autowired
	private TeacherService service;
	
	/*//http://localhost:8090/springmvc/teacher/insert.do?teacherName=pp&teacherAge=18
	@RequestMapping("/insert")
	@ResponseBody
	public int insert(TeacherEntity entity){
		int i = service.insert(entity);
		return i;
		
	}*/
	
	//http://localhost:8090/springmvc/teacher/insert.do?teacherName=pp&teacherAge=18
	//http://localhost:8090/springmvc/teacher/insert/lh/14.do
	@RequestMapping("/insert/{teacherName}/{teacherAge}")
	@ResponseBody
	public int insert(@RequestParam(value="teacherName",required=false) String name,
					  @RequestParam(value="teacherAge",required=false) Integer age){
//		int i = service.insert(entity);
		System.out.println(name+","+age);
		return 1;
	}
	
	
//	 List<TeacherEntity> fingAll();
	
	//http://localhost:8090/springmvc/teacher/xx.do?school=itjob
//	@RequestMapping(value="/xx",method=RequestMethod.GET,params="school=itjob")
	@RequestMapping(value="/xx",method=RequestMethod.GET)
	@ResponseBody
	public int paramsDemo01(String school){
		System.out.println("进入paramsDemo01"+school);
		return 1;
		
	}
	
	
}
